home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / docume1a / frmopend < prev    next >
Text File  |  1999-09-10  |  3KB  |  107 lines

  1. VERSION 5.00
  2. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.1#0"; "RICHTX32.OCX"
  3. Begin VB.Form frmOpenDoc 
  4.    Caption         =   "New Document"
  5.    ClientHeight    =   5115
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   6150
  9.    ClipControls    =   0   'False
  10.    LinkTopic       =   "Form1"
  11.    LockControls    =   -1  'True
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   5115
  14.    ScaleWidth      =   6150
  15.    Visible         =   0   'False
  16.    Begin RichTextLib.RichTextBox RichTextBox1 
  17.       Height          =   4815
  18.       Left            =   0
  19.       TabIndex        =   0
  20.       Top             =   120
  21.       Width           =   10000
  22.       _ExtentX        =   17648
  23.       _ExtentY        =   8493
  24.       _Version        =   327681
  25.       ScrollBars      =   2
  26.       DisableNoScroll =   -1  'True
  27.       TextRTF         =   $"frmOpenDoc.frx":0000
  28.    End
  29. End
  30. Attribute VB_Name = "frmOpenDoc"
  31. Attribute VB_GlobalNameSpace = False
  32. Attribute VB_Creatable = False
  33. Attribute VB_PredeclaredId = True
  34. Attribute VB_Exposed = False
  35.  
  36.  
  37. Private Sub Form_Load()
  38. Width = 0.9 * Screen.Width
  39. Height = 0.6 * Screen.Height
  40. RichTextBox1.RightMargin = RichTextBox1.Width
  41. End Sub
  42. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  43. If boolnew = True And boolsave = True Then
  44. Response = MsgBox("  Do You Want To Save Changes?", vbQuestion + vbYesNoCancel)
  45. MDIForm1.CommonDialog2.CancelError = True
  46. On Error GoTo ErrHandler
  47. Select Case Response
  48. Case vbYes
  49. On Error GoTo ErrHandler
  50. MDIForm1.CommonDialog2.Flags = &H2 'File exists
  51. MDIForm1.CommonDialog2.ShowSave
  52. frmOpenDoc.RichTextBox1.SaveFile MDIForm1.CommonDialog2.filename
  53. boolsave = False
  54. ControlsDisabled
  55. End
  56. Case vbNo
  57. ControlsDisabled
  58. End Select
  59. Else
  60. If boolsave = True Then
  61. Response = MsgBox("  Do You Want To Save Changes?", vbQuestion + vbYesNoCancel)
  62. MDIForm1.CommonDialog2.CancelError = True
  63. On Error GoTo ErrHandler
  64. Select Case Response
  65. Case vbYes
  66. Call SaveDoc
  67. If bCannotSave = False Then
  68. ControlsDisabled
  69. End If
  70. Case vbNo
  71. ControlsDisabled
  72. End Select
  73. Else
  74. ControlsDisabled
  75. End If
  76. End If
  77. ErrHandler:
  78. Cancel = True
  79. End Sub
  80. Private Sub Form_Resize()
  81. RichTextBox1.Height = ScaleHeight
  82. RichTextBox1.Width = ScaleWidth
  83.  
  84. If (Me.WindowState = 1 Or Me.WindowState = 2) Then Exit Sub
  85.  
  86. If Me.Height < 5000 Then
  87.     Me.Height = 5000
  88. End If
  89.  
  90. If Me.Width < 7000 Then
  91.     Me.Width = 10000
  92. End If
  93. End Sub
  94.  
  95. Private Sub RichTextBox1_Change()
  96. If RichTextBox1.SelLength > 0 Then
  97. MDIForm1.mnuSave.Enabled = True
  98. MDIForm1.Toolbar1.Buttons(3).Enabled = True
  99. MDIForm1.mnuSaveAs.Enabled = True
  100. MDIForm1.Toolbar1.Buttons(4).Enabled = True
  101. boolsave = True
  102. End If
  103. End Sub
  104. Private Sub RichTextBox1_KeyDown(KeyCode As Integer, Shift As Integer)
  105. Call RichTextKeyDown
  106. End Sub
  107.